From 72344c0921c6db5091d0f94af98babb77b89caae Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 10 Apr 2006 18:56:34 +0100 Subject: [PATCH] Netfront must switch state using xenbus_switch_state() or this is not picked up by the waiting code in xenbus_probe.c. Also clean up the waiting code a little. Signed-off-by: Keir Fraser --- .../drivers/xen/netfront/netfront.c | 9 ++------- .../drivers/xen/xenbus/xenbus_probe.c | 17 +++++++---------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 1336be5432..9a1aebefd7 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -300,13 +300,6 @@ again: goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, - "state", "%d", XenbusStateConnected); - if (err) { - message = "writing frontend XenbusStateConnected"; - goto abort_transaction; - } - err = xenbus_transaction_end(xbt, 0); if (err) { if (err == -EAGAIN) @@ -315,6 +308,8 @@ again: goto destroy_ring; } + xenbus_switch_state(dev, XenbusStateConnected); + return 0; abort_transaction: diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index 945a129cf1..94fd44f7f9 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -1065,19 +1065,16 @@ postcore_initcall(xenbus_probe_init); */ static int __init wait_for_devices(void) { - int i; - - for (i = 0; i < 10 * HZ; i++) { - if (all_devices_ready()) { - return; - } + unsigned long timeout = jiffies + 10*HZ; - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); + while (time_before(jiffies, timeout)) { + if (all_devices_ready()) + return 0; + schedule_timeout_interruptible(HZ/10); } - printk(KERN_WARNING - "XENBUS: Timeout connecting to devices!\n"); + printk(KERN_WARNING "XENBUS: Timeout connecting to devices!\n"); + return 0; } late_initcall(wait_for_devices); -- 2.30.2